package com.example.springdemo.commtest;

import com.alibaba.fastjson.JSONObject;
import com.example.springdemo.entity.Student;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

public class AI {
    public static void main(String[] args) {

        Student student = new Student();
        student.setPhoneNum("1111");
//        student.setName("张三").setId(1).setPhoneNum("19254037221");
//        String jsonString = JSONObject.toJSONString(student);
//        Student student1 = JSONObject.parseObject(jsonString, Student.class);


        String s = Optional.ofNullable(student).map(Student::getName).orElse("-");
        System.out.println(s);

    }
}
